import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/views/LayoutView.vue'
import LoginView from '@/views/LoginView.vue'
import HomeView from '@/views/HomeView.vue'
import ProductListview from '@/views/ProductListView.vue'
import CategoryView from '@/views/CategoryView.vue'
import SwiperlistView from '@/views/SwiperlistView.vue'
import SwiperaddView from '@/views/SwiperaddView.vue'
import UserManageView from '@/views/UserManageView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: Layout,
      redirect: '/home',
      children: [
        {
          path: '/home',
          name: 'home',
          component: HomeView,
        },
        {
          path: '/prolist',
          name: 'prolist',
          component: ProductListview,
        },
        {
          path: '/category',
          name: 'category',
          component: CategoryView,
        },
        {
          path: '/swiperlist',
          name: 'swiperlist',
          component: SwiperlistView,
        },
        {
          path: '/swiperadd',
          name: 'swiperadd',
          component: SwiperaddView,
        },
        {
          path: '/usermanage',
          name: 'usermanage',
          component: UserManageView,
        },
      ],
    },
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
  ],
})

export default router
